#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <mmsystem.h>
#include "timer.h"

// Multimedia-Timer verwenden
MMRESULT FTimerID;

#pragma comment(lib, "winmm.lib")

void CALLBACK TimeProc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
	timer_isr();
}

void init_timer_hw()
{
	timeBeginPeriod(1);
	FTimerID = timeSetEvent(1, 0, TimeProc, NULL, TIME_PERIODIC);
}

void exit_timer_hw()
{
	timeKillEvent(FTimerID);
	timeEndPeriod(1);
}
